package com.javabase.study.OOPFistPart;

/**
 * TODO
 * 内容：测试学习内部类
 * 作者:jxx
 * 创建时间：2021/6/20
 */
public class TestInnerClass {
    int out_i = 100;
    private int age = 18;

    void test(){
        Inner in = new Inner();
        in.display();
        in.show();
        System.out.println(in.a);
    }
    public static void main(String[] args){

        TestInnerClass testInnerClass = new TestInnerClass();

        testInnerClass.test();
    }
    class Inner{
        int a = 5;
        int age = 20;
        public void show(){
            int age = 30;
            System.out.println("内部类方法里的局部变量age: " + age);
            System.out.println("内部类的成员变量age: " + this.age);
            System.out.println("外部类的成员变量age: " + TestInnerClass.this.age);
        }
        void display(){
            System.out.println("display:outer_i = " + out_i);
        }
    }
}
